import { UserInfo } from '../../../store';
import { ApiUserInfo, ApiUserLogin } from './Type';

export const getUserInfo = (data: ApiUserInfo) => {
    // return request.post(PORT1 + '/userinfo', data);
    console.log(data);
    return new Promise((resolve) => {
        setTimeout(() => {
            resolve({
                code: 200,
                msg: '获取成功',
                info: {
                    id: 1,
                    name: '张三',
                },
            });
        }, 1000);
    });
};

export const userLogin = (
    data: ApiUserLogin
): Promise<{
    token: string;
    info: UserInfo;
}> => {
    // return request.post(PORT1 + '/login', data);
    console.log(data);
    return new Promise((resolve) => {
        setTimeout(() => {
            resolve({
                token: 'tokenName',
                info: {
                    id: 1,
                    name: '张三',
                },
            });
        }, 1000);
    });
};
